package com.nbsaas.boot.merchant.rest.resource;

import com.nbsaas.boot.merchant.api.apis.MerchantStatisticsApi;
import com.nbsaas.boot.merchant.data.entity.MerchantStatistics;
import com.nbsaas.boot.merchant.api.domain.request.MerchantStatisticsRequest;
import com.nbsaas.boot.merchant.api.domain.response.MerchantStatisticsResponse;
import com.nbsaas.boot.merchant.api.domain.simple.MerchantStatisticsSimple;
import com.nbsaas.boot.merchant.rest.convert.MerchantStatisticsSimpleConvert;
import com.nbsaas.boot.merchant.rest.convert.MerchantStatisticsEntityConvert;
import com.nbsaas.boot.merchant.rest.convert.MerchantStatisticsResponseConvert;
import com.nbsaas.boot.merchant.data.repository.MerchantStatisticsRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   商家统计-业务接口实现
*/
@Transactional
@Service
public class MerchantStatisticsResource extends BaseResource<MerchantStatistics,MerchantStatisticsResponse, MerchantStatisticsSimple, MerchantStatisticsRequest>  implements MerchantStatisticsApi {

    @Resource
    private MerchantStatisticsRepository merchantStatisticsRepository;

    @Override
    public JpaRepositoryImplementation<MerchantStatistics, Serializable> getJpaRepository() {
        return merchantStatisticsRepository;
    }

    @Override
    public Function<MerchantStatistics, MerchantStatisticsSimple> getConvertSimple() {
        return new MerchantStatisticsSimpleConvert();
    }

    @Override
    public Function<MerchantStatisticsRequest, MerchantStatistics> getConvertForm() {
        return new MerchantStatisticsEntityConvert();
    }

    @Override
    public Function<MerchantStatistics, MerchantStatisticsResponse> getConvertResponse() {
        return new MerchantStatisticsResponseConvert();
    }




}


